<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>  </title>
    <style>
/* .box p:nth-child(3){ 
    color: red;
}*/
.box p:nth-of-type(3){
    color:red;
}

    </style>
</head>
<body>
    <div class="box">
        <p>元素1</p>
        <p>元素2</p>
        <div>块1</div>
        <p>元素3</p>
        <p>元素4</p>
    </div>
</body>
</html>